package com.cmii.sjw.department.control.jsc.controller;

import com.cmii.sjw.department.control.jsc.service.SchoolInfoService;
import com.cmii.sjw.department.control.jsc.util.Result;
import com.cmii.sjw.department.control.jsc.vo.SchoolInfoVO;
import org.springframework.web.bind.annotation.*;

import jakarta.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 学校带坐标信息Controller
 *
 * @author lizheng
 * @date 2024-11-20
 */
@RestController
@CrossOrigin
@RequestMapping("/information")
public class SchoolInfoController {

    @Resource
    private SchoolInfoService schoolInfoService;

    /**
     * 学校带坐标信息
     *
     * @return 列表
     */
    @PostMapping("/list")
    public Result<Map<String, List<String>>> listSchool() {
        Map<String, List<String>> result = schoolInfoService.listSchool();
        return Result.success(result);
    }

    /**
     * 学校带坐标信息
     *
     * @return 数据入库
     */
    @PostMapping("/saveData")
    public Result saveData(){
        schoolInfoService.saveData();
        return Result.success();
    }

    /**
     * 学校带坐标信息
     * @return 首页展示
     */
    @PostMapping("/index")
    public Result<List<SchoolInfoVO>> index() {
        return Result.success(schoolInfoService.index());
    }
}
